package cn.hinglo.gameclaw.admin.action;


import cn.hinglo.gameclaw.admin.service.AdminIndexService;
import cn.hinglo.gameclaw.data.controller.BaseController;
import cn.hinglo.gameclaw.data.entity.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 * @createTime: 2017/12/29
 * @author: HingLo
 * @description: 首页管理
 */
@RestController
@RequestMapping("admin")
public class AdminIndexAction extends BaseController {
    private final AdminIndexService adminIndexService;

    @Autowired
    public AdminIndexAction(AdminIndexService adminIndexService) {
        this.adminIndexService = adminIndexService;
    }

    /**
     * 访问首页
     *
     * @return 操作结果
     */
    @GetMapping("index")
    public Result indexAction() {
        return success();
    }


    /**
     * 微信与QQ用户比例分布图
     *
     * @return 操作结果
     */
    @GetMapping("userProportion")
    public Result userProportion() {
        return success(adminIndexService.userProportionService());
    }


    /**
     * 过去num天指定type人数变化
     *
     * @param num  过去天数，包括今天
     * @param type 用户类型，QQ：3 微信：2
     * @return 操作结果
     */
    @GetMapping("userChange")
    public Result userAddData(@RequestParam("num") Integer num, @RequestParam("type") Integer type) {
        return adminIndexService.userAddDataService(num, type);
    }

    /**
     * 待发货的订单查看
     *
     * @return 订单列表
     */
    @GetMapping("order")
    public Result order() {
        //todo 待实现的订单查看
        return success();
    }
}